/** \file Note.h
    \author belot.nicolas
    Something with note and duration
*/

#ifndef NOTE_H
#define NOTE_H 1

#include "NoteFrequency.h"
#include <string>
namespace libtrckr {


class Duration {
/** \class libtrckr::Duration */
	public :
		enum note_duration_t {//Ronde, blanche, noir, croche, double-croche, triple-croche, quadruple-croche
		WHOLE=0, HALF=1, QUARTER=2, EIGHTH=3,SIXTEENTH=4, THIRTYSECOND=5,SIXTYFOURTH=6,
		RONDE=0, BLANCHE=1, NOIRE=2, CROCHE=3, DBLECROCHE=4,TRPLECROCHE=5,QUADPLECROCHE=6,
		SEMIBREVE=0, MININ=1, CROTCHET=2,QUAVER=3,SEMIQUAVER=4, DEMISEMIQUAVER=5, HEMIDEMISEMIQUAVER=6
		};

		Duration(note_duration_t=NOIRE);
		Duration(const Duration&);

		
		float getLength() const;


		Duration operator+(const Duration&);
		void operator+=(const Duration&);
		void operator=(const Duration&);
	private :
		double length;
	
};

class Note {
	/** \class libtrckr::Note */
	public:

	Note( );//Create a A4 black.
	Note(std::string&, Duration::note_duration_t, bool);
	Note(std::string&, Duration&, bool);
	Note(uint, uint, Duration::note_duration_t, bool);//semitone, octave, length, pointed C 4 => 0,4...
	Note(const Note&);

	double duration() const;//in ms
	uint   sampleLength() const;//in Sample
	std::string name() const;
	float frequency() const;
	float getLength() const;

	static unsigned short bpm();
	static void bpm(unsigned short);

	static unsigned short mesure() ;
	static void mesure(unsigned short);


	static unsigned int bitrate() ;
	static void bitrate(unsigned int);

	static const float keyFreq[10][21];

	static const std::string keyName[10][21];

	

	private:
		std::string _name;
		float freq;
		Duration len;
		bool pointed;
		static unsigned short _bpm;
		static unsigned short _mesure;
		static unsigned int _bitrate;
};


}
#endif

